package com.wuqing.consumer.config;

/**
 * @author wuqing
 * @date 2020/8/7
 */

import com.wuqing.consumer.interceptor.IpGetInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器,配置拦截的路径
        // InterceptorRegistration ir = registry.addInterceptor(new IpGetInterceptor()).addPathPatterns("/**");

        // 配置不拦截的路径
        // ir.excludePathPatterns("/user/info", "/user/add");
        // 还可以在这里注册其它的拦截器
        //registry.addInterceptor(new OtherInterceptor()).addPathPatterns("/**");
    }

}